<?php declare(strict_types=1);

namespace App\Services\Entity\Impl;

use App\Services\Entity\PasswordService;

class PasswordServiceImpl implements PasswordService
{
    /**
     * 用户密码加密
     * @param $password
     * @param $newSalt
     * @return array
     */
    public function mixSalt($password, $newSalt = '')
    {
        if (empty($newSalt)) {
            $newSalt = uniqid();
        }

        return [
            'salt' => $newSalt,
            'pass' => md5($newSalt . $password)
        ];
    }
}
